import 'extended_info.dart';
import 'sport_description.dart';
import 'unit_date_time.dart';
import 'venue_description.dart';

class ExtendedInfos {
  UnitDateTime? unitDateTime;
  List<ExtendedInfo>? extendedInfo;
  SportDescription? sportDescription;
  VenueDescription? venueDescription;

  ExtendedInfos({
    this.unitDateTime,
    this.extendedInfo,
    this.sportDescription,
    this.venueDescription,
  });

  factory ExtendedInfos.fromJson(Map<String, dynamic> json) => ExtendedInfos(
        unitDateTime: json['UnitDateTime'] == null
            ? null
            : UnitDateTime.fromJson(
                json['UnitDateTime'] as Map<String, dynamic>),
        extendedInfo: (json['ExtendedInfo'] as List<dynamic>?)
            ?.map((e) => ExtendedInfo.fromJson(e as Map<String, dynamic>))
            .toList(),
        sportDescription: json['SportDescription'] == null
            ? null
            : SportDescription.fromJson(
                json['SportDescription'] as Map<String, dynamic>),
        venueDescription: json['VenueDescription'] == null
            ? null
            : VenueDescription.fromJson(
                json['VenueDescription'] as Map<String, dynamic>),
      );

  Map<String, dynamic> toJson() => {
        'UnitDateTime': unitDateTime?.toJson(),
        'ExtendedInfo': extendedInfo?.map((e) => e.toJson()).toList(),
        'SportDescription': sportDescription?.toJson(),
        'VenueDescription': venueDescription?.toJson(),
      };
}
